package reifnsk.minimap;

import net.minecraft.src.RenderManager;

class WaypointEntityRender$ViewWaypoint extends Waypoint implements Comparable<WaypointEntityRender$ViewWaypoint>
{
    double dx;
    double dy;
    double dz;
    double dl;
    double distance;

    final WaypointEntityRender this$0;

    WaypointEntityRender$ViewWaypoint(WaypointEntityRender var1, Waypoint w, double dscale)
    {
        super(w);
        this.this$0 = var1;
        double var10001 = (double)w.x * dscale;
        WaypointEntityRender.access$000(var1);
        this.dx = var10001 - RenderManager.renderPosX + 0.5D;
        var10001 = (double)w.y;
        WaypointEntityRender.access$100(var1);
        this.dy = var10001 - RenderManager.renderPosY + 0.5D;
        var10001 = (double)w.z * dscale;
        WaypointEntityRender.access$200(var1);
        this.dz = var10001 - RenderManager.renderPosZ + 0.5D;
        this.dl = this.distance = Math.sqrt(this.dx * this.dx + this.dy * this.dy + this.dz * this.dz);

        if (this.dl > var1.far)
        {
            double d = var1.far / this.dl;
            this.dx *= d;
            this.dy *= d;
            this.dz *= d;
            this.dl = var1.far;
        }
    }

    public int compareTo(WaypointEntityRender$ViewWaypoint o)
    {
        return o.distance < this.distance ? -1 : (o.distance > this.distance ? 1 : 0);
    }

 //   public int compareTo(Object x0)
 //   {
 //       return this.compareTo((WaypointEntityRender$ViewWaypoint)x0);
 //   }
}
